home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / economic / cje.bst < prev    next >
Text File  |  1993-05-28  |  26KB  |  1,193 lines

  1. % BibTeX bibliography style `cje' (Canadian Journal of Economics)
  2. % this file is based on the `harvard' family of files
  3.         % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  4.         % Copyright (C) 1991, all rights reserved.
  5.         % Copying of this file is authorized only if either
  6.         % (1) you make absolutely no changes to your copy, including name, or
  7.         % (2) if you do make changes, you name it something other than
  8.         % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  9.         % dcu.bst, cje.bst, aer.bst, or kluwer.bst.
  10.         % This restriction helps ensure that all standard styles are identical.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address author booktitle chapter edition editor howpublished institution
  22.     journal key month note number organization pages publisher school
  23.     series title type volume year}
  24.   { field.used }
  25.   { canonical.label extra.label sort.label list.year }
  26.  
  27.  
  28. INTEGERS {quoted italic bold plain attribute
  29.         space comma tiedcomma semicolon colon period block empty separator
  30.         prev.separator next.separator next.attribute}
  31.  
  32. STRINGS { s temp f name.list first.name.format later.name.formats name.style}
  33.  
  34. FUNCTION {init.state.consts}
  35. {
  36.   #100  'quoted :=
  37.   #200  'italic :=
  38.   #300  'bold   :=
  39.   #400  'plain  :=
  40.  
  41.   #7 'space :=
  42.   #6 'comma :=
  43. %  #5 'tiedcomma :=
  44. %  #4 'semicolon :=
  45. %  #3 'colon :=
  46.   #2 'period :=
  47.   #1 'block :=
  48.   #0 'empty :=
  49. }
  50.  
  51. FUNCTION {output2}
  52. {
  53. % Wrap the attribute.
  54.     attribute bold = {"{\bf " swap$ * "}" *} {} if$
  55.     attribute italic = {"{\it " swap$ * "}" *} {} if$
  56.     attribute quoted = {"`" swap$ * "'" *} {} if$
  57. % Append additional separators
  58.     separator comma = {"," * space 'separator :=} {} if$
  59. %    separator tiedcomma = {",~" * empty 'separator :=} {} if$
  60.     separator space = {" " *} {} if$
  61.     write$
  62.     separator block = {newline$ "\newblock " write$} {} if$
  63. % Update variables, and put the new string back on the stack
  64.     next.attribute 'attribute :=
  65.     next.separator 'separator :=
  66.     temp
  67. }
  68.  
  69. % <string> <separator> <string> <attribute> <final separator> output <string>
  70. FUNCTION {output.nonnull}
  71. {   'next.separator :=
  72.     'next.attribute :=
  73.     'temp :=
  74.     'prev.separator :=
  75. % If the new separator is stronger than the previous one, use it.
  76.     prev.separator separator < {prev.separator 'separator :=} {} if$
  77. % Append most separators to the string.
  78.     separator block = {add.period$} {} if$
  79.     separator period = {add.period$ space 'separator :=} {} if$
  80.     separator comma = {"," * space 'separator :=} {} if$
  81. %    separator semicolon = {";" * space 'separator :=} {} if$
  82. %    separator colon = {":" * space 'separator :=} {} if$
  83.     output2
  84. }
  85.  
  86. FUNCTION {output}
  87. {   'next.separator :=
  88.     'next.attribute :=
  89.     duplicate$ empty$
  90.         {pop$ pop$}
  91.         {next.attribute next.separator output.nonnull}
  92.         if$
  93. }
  94.  
  95. FUNCTION {output.check}
  96. {   's :=
  97.     'next.separator :=
  98.     'next.attribute :=
  99.     duplicate$ empty$
  100.         {pop$ pop$ "empty " s * " in " * cite$ * warning$ }
  101.         {next.attribute next.separator output.nonnull}
  102.         if$
  103. }
  104.  
  105. FUNCTION {item.check}
  106. { 'temp :=
  107.   empty$
  108.     { "empty " temp * " in " * cite$ * warning$ }
  109.     {}
  110.   if$
  111. }
  112.  
  113. FUNCTION {plain.space} { plain space }
  114.  
  115. FUNCTION {plain.space.output} { plain.space output }
  116.  
  117. FUNCTION {fin.entry}
  118. {   block note plain.space.output
  119.  
  120.   empty 'separator :=
  121.   empty "" plain empty output.nonnull pop$
  122.   newline$
  123. }
  124.  
  125. FUNCTION {not}
  126. {   { #0 }
  127.     { #1 }
  128.   if$
  129. }
  130.  
  131. FUNCTION {and}
  132. {   {}
  133.     { pop$ #0 }
  134.   if$
  135. }
  136.  
  137. FUNCTION {or}
  138. {   { pop$ #1 }
  139.     {}
  140.   if$
  141. }
  142.  
  143. FUNCTION {field.or.null}
  144. { duplicate$ empty$
  145.     { pop$ "" }
  146.     {}
  147.   if$
  148. }
  149.  
  150. FUNCTION {emphasize}
  151. { duplicate$ empty$
  152.     { pop$ "" }
  153.     { "{\em " swap$ * "}" * }
  154.   if$
  155. }
  156.  
  157. FUNCTION {quote}
  158. { duplicate$ empty$
  159.     { pop$ "" }
  160.     { add.period$ "`" swap$ * "'" * }
  161.   if$
  162. }
  163.  
  164. INTEGERS { nameptr namesleft numnames }
  165.  
  166. FUNCTION {format.names}
  167. { 'name.list :=
  168.   'name.style :=
  169.   'later.name.formats :=
  170.   's := % binary separator
  171.   'first.name.format :=
  172.   #1 'nameptr :=
  173.   name.list num.names$ 'numnames :=
  174. % If we're to make this entry bold or something, prepend to the string of names
  175.   name.style "" = {} {"{" name.style *} if$
  176.   numnames 'namesleft :=
  177.     { namesleft #0 > }
  178.     { name.list nameptr nameptr #1 = {first.name.format} {later.name.formats} if$
  179.                 format.name$ 'temp :=
  180.       nameptr #1 >
  181.         { namesleft #1 >
  182.             { ", " * temp * }
  183.             { temp "others" =
  184.                 { " et~al." * }
  185.                 {nameptr #2 =   % handle ", and" vs " and "
  186.                     {s * temp *}
  187.                     {", and " * temp * }
  188.                     if$
  189.                 }
  190.                 if$
  191.             }
  192.             if$
  193.         }
  194.         'temp
  195.         if$
  196.       nameptr #1 + 'nameptr :=
  197.       namesleft #1 - 'namesleft :=
  198.     }
  199.   while$
  200. % If we're to make this entry bold or something, append to the string of names
  201.   name.style "" = {} {"}" * *}  if$
  202. }
  203.  
  204. FUNCTION {format.authors}
  205. { author empty$
  206.     { "" }
  207.     { extra.label "\bysame" =
  208.          {"\bysame"}
  209.          { "{vv~}{ll}{, jj}{, ff}" ", and " "{ff~}{vv~}{ll}{, jj}" "" author
  210.                 format.names }
  211.          if$
  212.     }
  213.     if$
  214. }
  215.  
  216. FUNCTION {format.editors}
  217. { editor empty$
  218.     { "" }
  219.     { "{vv~}{ll}{, jj}{, ff}" ", and " "{ff~}{vv~}{ll}{, jj}" ""
  220.                 editor format.names
  221.       editor num.names$ #1 >
  222.         { ", eds" * }
  223.         { ", ed." * }
  224.       if$
  225.     }
  226.   if$
  227. }
  228.  
  229. FUNCTION {format.editors.reverse}
  230. { editor empty$
  231.     { "" }
  232.     { "ed. "
  233.       "{ff~}{vv~}{ll}{, jj}" " and " "{ff~}{vv~}{ll}{, jj}" ""
  234.                 editor format.names
  235.       *
  236.     }
  237.   if$
  238. }
  239.  
  240. FUNCTION {format.title}
  241. { space
  242.   title empty$
  243.     { "" }
  244.     { title "t" change.case$}
  245.   if$
  246.  quoted period
  247. }
  248.  
  249. FUNCTION {n.dashify}
  250. { 'temp :=
  251.   ""
  252.     { temp empty$ not }
  253.     { temp #1 #1 substring$ "-" =
  254.         { temp #1 #2 substring$ "--" = not
  255.             { "--" *
  256.               temp #2 global.max$ substring$ 'temp :=
  257.             }
  258.             {   { temp #1 #1 substring$ "-" = }
  259.                 { "-" *
  260.                   temp #2 global.max$ substring$ 'temp :=
  261.                 }
  262.               while$
  263.             }
  264.           if$
  265.         }
  266.         { temp #1 #1 substring$ *
  267.           temp #2 global.max$ substring$ 'temp :=
  268.         }
  269.       if$
  270.     }
  271.   while$
  272. }
  273.  
  274. FUNCTION {format.btitle}
  275. { title emphasize
  276. }
  277.  
  278. FUNCTION {tie.or.space.connect}
  279. { duplicate$ text.length$ #3 <
  280.     { "~" }
  281.     { " " }
  282.   if$
  283.   swap$ * *
  284. }
  285.  
  286. FUNCTION {either.or.check}
  287. { empty$
  288.     'pop$
  289.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  290.   if$
  291. }
  292.  
  293. FUNCTION {format.bvolume}
  294. { volume empty$
  295.     { "" }
  296.     { "vol." volume tie.or.space.connect
  297.       series empty$
  298.         {}
  299.         { " of " * series emphasize * }
  300.       if$
  301.       "volume and number" number either.or.check
  302.     }
  303.   if$
  304. }
  305.  
  306. FUNCTION {mid.sentence.q}
  307. {
  308.     separator empty = separator block = separator period = or or not
  309. }
  310.  
  311. FUNCTION {format.number.series}
  312. { volume empty$
  313.     { number empty$
  314.         {series field.or.null}
  315.         { mid.sentence.q
  316.             { "number" }
  317.             { "Number" }
  318.           if$
  319.           number tie.or.space.connect
  320.           series empty$
  321.             { "there's a number but no series in " cite$ * warning$ }
  322.             { add.period$ " In " * series quote * }
  323.           if$
  324.         }
  325.       if$
  326.     }
  327.     { "" }
  328.   if$
  329. }
  330.  
  331. FUNCTION {format.edition}
  332. { edition empty$
  333.     { "" }
  334.     { edition
  335.       mid.sentence.q { "l"} { "t"} if$
  336.       change.case$ " ed." * 
  337.     }
  338.   if$
  339. }
  340.  
  341. FUNCTION {format.publisher.address}
  342. {
  343.     publisher empty$ address empty$ and
  344.         {}
  345.         { space
  346.             address empty$ {"("} {"(" address *} if$
  347.             publisher empty$ address empty$ or {} {": " *} if$
  348.             publisher empty$ {} {publisher *} if$
  349.             ")" * plain.space output.nonnull
  350.         }
  351.         if$
  352. }
  353.  
  354. INTEGERS { multiresult }
  355.  
  356. FUNCTION {multi.page.check}
  357. { 'temp :=
  358.   #0 'multiresult :=
  359.     { multiresult not
  360.       temp empty$ not
  361.       and
  362.     }
  363.     { temp #1 #1 substring$
  364.       duplicate$ "-" =
  365.       swap$ duplicate$ "," =
  366.       swap$ "+" =
  367.       or or
  368.         { #1 'multiresult := }
  369.         { temp #2 global.max$ substring$ 'temp := }
  370.       if$
  371.     }
  372.   while$
  373.   multiresult
  374. }
  375.  
  376. FUNCTION {format.pages}
  377. { pages empty$
  378.     { "" }
  379.     { pages multi.page.check
  380.         { "pp.~" pages n.dashify * }
  381.         { "p.~" pages * }
  382.       if$
  383.     }
  384.   if$
  385. }
  386.  
  387. FUNCTION {output.vol.num.pages}
  388. { space
  389.   volume field.or.null
  390.   number empty$
  391.     {}
  392.     { "(" number * ")" * *
  393.       volume empty$
  394.         { "there's a number but no volume in " cite$ * warning$ }
  395.         {}
  396.       if$
  397.     }
  398.   if$
  399.   pages empty$
  400.     {}
  401.     { duplicate$ empty$
  402.         { pop$ format.pages }
  403.         { ",~" * pages n.dashify * }
  404.       if$
  405.     }
  406.   if$
  407.   plain.space.output
  408. }
  409.  
  410. FUNCTION {format.chapter.pages}
  411. { chapter empty$
  412.     'format.pages
  413.     { type empty$
  414.         { "chapter" }
  415.         { type "l" change.case$ }
  416.       if$
  417.       chapter tie.or.space.connect
  418.       pages empty$
  419.         {}
  420.         { ", " * format.pages * }
  421.       if$
  422.     }
  423.   if$
  424. }
  425.  
  426. FUNCTION {output.in.ed.booktitle}
  427. {   booktitle empty$
  428.     { booktitle "booktitle" item.check }
  429.     { space "In" plain.space output.nonnull
  430.       editor empty$
  431.         { space booktitle quoted space output.nonnull}
  432.         { space booktitle italic comma output.nonnull
  433.           comma format.editors.reverse plain.space output.nonnull}
  434.       if$
  435.     }
  436.   if$
  437. }
  438.  
  439. FUNCTION {empty.misc.check}
  440. { author empty$ title empty$ howpublished empty$
  441.   month empty$ year empty$ note empty$
  442.   and and and and and
  443.   key empty$ not and
  444.     { "all relevant fields are empty in " cite$ * warning$ }
  445.     {}
  446.   if$
  447. }
  448.  
  449. FUNCTION {format.thesis.type}
  450. { type empty$
  451.     {}
  452.     { pop$
  453.       type "t" change.case$
  454.     }
  455.   if$
  456. }
  457.  
  458. FUNCTION {format.tr.number}
  459. { type empty$
  460.     { "Technical Report" }
  461.     'type
  462.   if$
  463.   number empty$
  464.     {  }
  465.     { number tie.or.space.connect }
  466.   if$
  467. }
  468.  
  469. FUNCTION {format.article.crossref}
  470. { key empty$
  471.     { journal empty$
  472.         { "need key or journal for " cite$ * " to crossref " * crossref *
  473.           warning$
  474.           ""
  475.         }
  476.         { "in {\it " journal * "\/} \cite{" * crossref * "}" *}
  477.       if$
  478.     }
  479.     { add.period$ "In \citeasnoun{" crossref * "}" * }
  480.   if$
  481.  
  482. }
  483.  
  484. FUNCTION {format.book.crossref}
  485. { volume empty$
  486.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  487.       "in "
  488.     }
  489.     { "Vol." volume tie.or.space.connect
  490.       " of " *
  491.     }
  492.   if$
  493.   editor empty$
  494.   editor field.or.null author field.or.null =
  495.   or
  496.     { key empty$
  497.         { series empty$
  498.             { "need editor, key, or series for " cite$ * " to crossref " *
  499.               crossref * warning$
  500.               "" *
  501.             }
  502.             { "{\it " * series * "\/} \cite{" * crossref * "}" *}
  503.           if$
  504.         }
  505.         { " \citeasnoun{" * crossref * "}" * }
  506.       if$
  507.     }
  508.     { " \citeasnoun{" * crossref * "}" * }
  509.   if$
  510. }
  511.  
  512. FUNCTION {output.incoll.inproc.crossref}
  513. { editor empty$
  514.   editor field.or.null author field.or.null =
  515.   or
  516.     { key empty$
  517.         { booktitle empty$
  518.             { "need editor, key, or booktitle for " cite$ * " to crossref " *
  519.               crossref * warning$
  520.             }
  521.             { period "In {\it " booktitle * "\/}" * " \cite{" * crossref * "}" * plain.space output.nonnull}
  522.           if$
  523.         }
  524.         { period "In \citeasnoun{" crossref * "}" * plain.space output.nonnull}
  525.       if$
  526.     }
  527.     { period "In \citeasnoun{" crossref * "}" * plain.space output.nonnull}
  528.   if$
  529. }
  530.  
  531. INTEGERS { len }
  532.  
  533. FUNCTION {chop.word}
  534. { 's :=
  535.   'len :=
  536.   s #1 len substring$ =
  537.     { s len #1 + global.max$ substring$ }
  538.     's
  539.   if$
  540. }
  541.  
  542. INTEGERS { author.field editor.field organization.field title.field key.field }
  543.  
  544. FUNCTION {init.field.constants}
  545. { #0 'author.field :=
  546.   #1 'editor.field :=
  547.   #2 'organization.field :=
  548.   #3 'title.field :=
  549.   #4 'key.field :=
  550. }
  551.  
  552. FUNCTION {format.lab.names.abbr}
  553. { 'name.list :=
  554.   name.list num.names$ 'numnames :=
  555.   numnames #1 >
  556.     { numnames #2 >
  557.         { name.list #1 "{vv~}{ll}" format.name$ " et al." * }
  558.         { name.list #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  559.             { name.list #1 "{vv~}{ll}" format.name$ " et al." * }
  560.             { name.list #1 "{vv~}{ll}" format.name$ " and " *
  561.               name.list #2 "{vv~}{ll}" format.name$ * 
  562.             }
  563.           if$
  564.         }
  565.       if$
  566.       field.used editor.field = {", eds" *} {} if$
  567.     }
  568.     {
  569.         name.list #1 "{vv~}{ll}" format.name$
  570.         field.used editor.field = {", ed" *} {} if$
  571.     }
  572.   if$
  573. }
  574.  
  575. FUNCTION {format.lab.names.full}
  576. { 'name.list :=
  577.   #1 'nameptr :=
  578.   name.list num.names$ 'numnames :=
  579.   numnames 'namesleft :=
  580.     { namesleft #0 > }
  581.     { name.list nameptr "{vv~}{ll}" format.name$ 'temp :=
  582.       nameptr #1 >
  583.         { namesleft #1 >
  584.             { ", " * temp * }
  585.             { temp "others" =
  586.                 { " et~al." * }
  587.                 { " and " * temp * }
  588.               if$
  589.             }
  590.           if$
  591.         }
  592.         'temp
  593.       if$
  594.       nameptr #1 + 'nameptr :=
  595.       namesleft #1 - 'namesleft :=
  596.     }
  597.   while$
  598.   numnames #1 > field.used editor.field = and {", eds" *} {} if$
  599.   numnames #1 = field.used editor.field = and {", ed" *} {} if$
  600. }
  601.  
  602. FUNCTION {make.list.label}
  603. { author.field field.used =
  604.     { format.authors }
  605.     { editor.field field.used =
  606.         { format.editors }
  607.         { organization.field field.used =
  608.             { "The " #4 organization chop.word}
  609.             { title.field field.used =
  610.                 { format.btitle }
  611.                 { key.field field.used =
  612.                     { key #3 text.prefix$ }
  613.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  614.                   if$
  615.                 }
  616.               if$
  617.             }
  618.           if$
  619.         }
  620.       if$
  621.     }
  622.   if$
  623. }
  624.  
  625. FUNCTION {make.full.label}
  626. { author.field field.used =
  627.     { author format.lab.names.full }
  628.     { editor.field field.used =
  629.         { editor format.lab.names.full }
  630.         { organization.field field.used =
  631.             { "The " #4 organization chop.word #3 text.prefix$ }
  632.             { title.field field.used =
  633.                 { format.btitle }
  634.                 { key.field field.used =
  635.                     { key #3 text.prefix$ }
  636.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  637.                   if$
  638.                 }
  639.               if$
  640.             }
  641.           if$
  642.         }
  643.       if$
  644.     }
  645.   if$
  646. }
  647.  
  648. FUNCTION {make.abbr.label}
  649. { author.field field.used =
  650.     { author format.lab.names.abbr }
  651.     { editor.field field.used =
  652.         { editor format.lab.names.abbr }
  653.         { organization.field field.used =
  654.             { "The " #4 organization chop.word #3 text.prefix$ }
  655.             { title.field field.used =
  656.                 { format.btitle }
  657.                 { key.field field.used =
  658.                     { key #3 text.prefix$ }
  659.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  660.                   if$
  661.                 }
  662.               if$
  663.             }
  664.           if$
  665.         }
  666.       if$
  667.     }
  668.   if$
  669. }
  670.  
  671. FUNCTION {output.bibitem}
  672. { newline$
  673.   "\harvarditem[" write$
  674.   make.abbr.label write$
  675.   "]{" write$
  676.   make.full.label write$
  677.   "}{" write$
  678.   list.year write$
  679.   "}{" write$
  680.   cite$ write$
  681.   "}" write$
  682.   newline$
  683.   ""
  684.   empty 'separator :=
  685.   plain 'attribute :=
  686.  
  687.  
  688. % FUNCTION {list.label.output}
  689.  
  690. space make.list.label plain.space output.nonnull
  691.   "n.d." list.year = 
  692.         {}
  693.         { space "(" list.year * ")" * plain.space output.nonnull}
  694.         if$
  695. }
  696.  
  697. FUNCTION {format.title.if.not.sortkey}
  698. {title.field field.used =
  699.     {}
  700.     { format.title output }
  701.   if$}
  702.  
  703. FUNCTION {format.title.if.not.sortkey.check}
  704. {title.field field.used =
  705.     {}
  706.     { format.title "title" output.check }
  707.   if$}
  708.  
  709. FUNCTION {article}
  710. { output.bibitem
  711.   author "author" item.check
  712.   format.title.if.not.sortkey.check
  713.   crossref missing$
  714.     { space journal italic space "journal" output.check
  715.       pages empty$
  716.         {}
  717.         {output.vol.num.pages}
  718.         if$
  719.     }
  720.     { space format.article.crossref plain.space output.nonnull
  721.       comma format.pages plain.space.output
  722.     }
  723.   if$
  724.   fin.entry
  725. }
  726.  
  727. FUNCTION {book}
  728. { output.bibitem
  729.   author empty$
  730.     { editor "author and editor" item.check }
  731.     { crossref missing$
  732.         { "author and editor" editor either.or.check }
  733.         {}
  734.       if$
  735.     }
  736.   if$
  737.   title.field field.used =
  738.     {}
  739.     { space title italic space "title" output.check }
  740.   if$
  741.   crossref missing$
  742.     {
  743.       space format.number.series plain.space.output
  744.       comma format.edition plain.space.output
  745.       comma format.bvolume plain.space.output
  746.       format.publisher.address
  747.     }
  748.     { space format.book.crossref plain.space output.nonnull
  749.       comma format.edition plain.space.output
  750.     }
  751.   if$
  752.   fin.entry
  753. }
  754.  
  755. FUNCTION {booklet}
  756. { output.bibitem
  757.   format.title.if.not.sortkey.check
  758.   space howpublished plain.space.output
  759.   space address plain.space.output
  760.   fin.entry
  761. }
  762.  
  763. FUNCTION {inbook}
  764. { output.bibitem
  765.   author empty$
  766.     { editor "author and editor" item.check }
  767.     { crossref missing$
  768.         { "author and editor" editor either.or.check }
  769.         {}
  770.       if$
  771.     }
  772.   if$
  773.   title.field field.used =
  774.     {}
  775.     { space title italic space "title" output.check }
  776.   if$
  777.   crossref missing$
  778.     { space format.number.series plain.space.output
  779.       comma format.edition plain.space.output
  780.       comma format.bvolume plain comma output
  781.       format.publisher.address
  782. %      space publisher plain.space "publisher" output.check
  783. %      space address plain.space.output
  784.     }
  785.     { space format.book.crossref plain.space output.nonnull
  786.       comma format.edition plain.space.output
  787.     }
  788.   if$
  789.   format.chapter.pages "chapter and pages" output.check
  790.   fin.entry
  791. }
  792.  
  793. FUNCTION {incollection}
  794. { output.bibitem
  795.   format.title.if.not.sortkey.check
  796.   author "author" item.check
  797.   crossref missing$
  798.     { output.in.ed.booktitle
  799.       comma format.edition plain.space.output
  800.       comma format.bvolume plain.space.output
  801.       space format.number.series plain.space.output
  802.       format.publisher.address
  803.     }
  804.     { output.incoll.inproc.crossref }
  805.   if$
  806.   space format.chapter.pages plain.space.output
  807.   fin.entry
  808. }
  809.  
  810. FUNCTION {inproceedings}
  811. { output.bibitem
  812.   format.title.if.not.sortkey.check
  813.   author "author" item.check
  814.   crossref missing$
  815.     { output.in.ed.booktitle
  816.       comma format.bvolume plain.space.output
  817.       space format.number.series plain.space.output
  818.       address empty$
  819.         { space organization plain.space.output
  820.           space publisher plain.space.output
  821.         }
  822.         { space organization plain.space.output
  823.           space publisher plain.space.output
  824.           space address plain.space output.nonnull
  825.         }
  826.       if$
  827.     }
  828.     { output.incoll.inproc.crossref}
  829.   if$
  830.   space format.pages plain.space.output
  831.   fin.entry
  832. }
  833.  
  834. FUNCTION {conference} { inproceedings }
  835.  
  836. FUNCTION {manual}
  837. { output.bibitem
  838.   title.field field.used =
  839.     {}
  840.     {author empty$ {comma}{space} if$
  841.      title italic space "title" output.check }
  842.   if$
  843.   organization.field field.used = organization empty$ or
  844.         {} {space organization plain.space output.nonnull} if$
  845.   comma format.edition plain.space.output
  846.   format.publisher.address
  847.   fin.entry
  848. }
  849.  
  850. FUNCTION {mastersthesis}
  851. { output.bibitem
  852.   author "author" item.check
  853.   format.title.if.not.sortkey.check  space "Master's thesis" format.thesis.type plain.space output.nonnull
  854.   comma school plain.space "school" output.check
  855.   comma address plain.space.output
  856.   fin.entry
  857. }
  858.  
  859. FUNCTION {misc}
  860. { output.bibitem
  861.   format.title.if.not.sortkey
  862.   space howpublished plain.space.output
  863.   fin.entry
  864.   empty.misc.check
  865. }
  866.  
  867. FUNCTION {phdthesis}
  868. { output.bibitem
  869.   author "author" item.check
  870.   format.title.if.not.sortkey.check
  871.   space "PhD dissertation" format.thesis.type plain.space output.nonnull
  872.   comma school plain.space "school" output.check
  873.   comma address plain.space.output
  874.   fin.entry
  875. }
  876.  
  877. FUNCTION {proceedings}
  878. { output.bibitem
  879.   title.field field.used =
  880.     {}
  881.     { space title italic space "title" output.check }
  882.   if$
  883.   comma format.bvolume plain.space.output
  884.   space format.number.series plain.space.output
  885.   address empty$
  886.     { editor empty$
  887.         {}
  888.         { space organization plain.space.output
  889.         }
  890.       if$
  891.       space publisher plain.space.output
  892.     }
  893.     { editor empty$
  894.         {}
  895.         { space organization plain.space.output }
  896.       if$
  897.       space publisher plain.space.output
  898.       space address plain.space output.nonnull
  899.     }
  900.   if$
  901.   fin.entry
  902. }
  903.  
  904. FUNCTION {techreport}
  905. { output.bibitem
  906.   author "author" item.check
  907.   format.title.if.not.sortkey.check
  908.   space format.tr.number plain.space output.nonnull
  909.   institution empty$
  910.     {}
  911.     { comma institution plain.space "institution" output.check }
  912.     if$
  913.   comma address plain.space.output
  914.   comma month plain.space.output
  915.   fin.entry
  916. }
  917.  
  918. FUNCTION {unpublished}
  919. { output.bibitem
  920.   author "author" item.check
  921.   format.title.if.not.sortkey.check
  922.   note "note" item.check
  923.   fin.entry
  924. }
  925.  
  926. FUNCTION {default.type} { misc }
  927.  
  928. MACRO {jan} {"January"}
  929.  
  930. MACRO {feb} {"February"}
  931.  
  932. MACRO {mar} {"March"}
  933.  
  934. MACRO {apr} {"April"}
  935.  
  936. MACRO {may} {"May"}
  937.  
  938. MACRO {jun} {"June"}
  939.  
  940. MACRO {jul} {"July"}
  941.  
  942. MACRO {aug} {"August"}
  943.  
  944. MACRO {sep} {"September"}
  945.  
  946. MACRO {oct} {"October"}
  947.  
  948. MACRO {nov} {"November"}
  949.  
  950. MACRO {dec} {"December"}
  951.  
  952. READ
  953.  
  954. EXECUTE {init.field.constants}
  955.  
  956. FUNCTION {sortify}
  957. { purify$
  958.   "l" change.case$
  959. }
  960.  
  961. FUNCTION {author.key.label}
  962. { author empty$
  963.     { title empty$
  964.         { key.field 'field.used := }
  965.         { title.field 'field.used := }
  966.       if$
  967.     }
  968.     { author.field 'field.used := }
  969.   if$
  970. }
  971.  
  972. FUNCTION {author.editor.key.label}
  973. { author empty$
  974.     { editor empty$
  975.         { title empty$
  976.             { key.field 'field.used := }
  977.             { title.field 'field.used := }
  978.           if$
  979.         }
  980.         { editor.field 'field.used := }
  981.       if$
  982.     }
  983.     { author.field 'field.used := }
  984.   if$
  985. }
  986.  
  987. FUNCTION {author.key.organization.label}
  988. { author empty$
  989.     { organization empty$
  990.         { title empty$
  991.             { key.field 'field.used := }
  992.             { title.field 'field.used := }
  993.           if$
  994.         }
  995.         { organization.field 'field.used := }
  996.         if$
  997.     }
  998.     { author.field 'field.used := }
  999.   if$
  1000. }
  1001.  
  1002. FUNCTION {editor.key.organization.label}
  1003. { editor empty$
  1004.     { organization empty$
  1005.         { title empty$
  1006.             { key.field 'field.used := }
  1007.             { title.field 'field.used := }
  1008.              if$
  1009.             }
  1010.        { organization.field 'field.used := }
  1011.        if$
  1012.     }
  1013.     { editor.field 'field.used := }
  1014.   if$
  1015. }
  1016.  
  1017. FUNCTION {sort.format.title}
  1018. { 'temp :=
  1019.   "A " #2
  1020.     "An " #3
  1021.       "The " #4 temp chop.word
  1022.     chop.word
  1023.   chop.word
  1024.   sortify
  1025.   #1 global.max$ substring$
  1026. }
  1027.  
  1028. FUNCTION {calc.label}
  1029. { type$ "book" =
  1030.   type$ "inbook" =
  1031.   or
  1032.     'author.editor.key.label
  1033.     { type$ "proceedings" =
  1034.         'editor.key.organization.label
  1035.         { type$ "manual" =
  1036.             'author.key.organization.label
  1037.             'author.key.label
  1038.           if$
  1039.         }
  1040.       if$
  1041.     }
  1042.   if$
  1043.   make.abbr.label
  1044.   title.field field.used =
  1045.     { sort.format.title }
  1046.     { sortify }
  1047.   if$
  1048.   year field.or.null purify$ #-1 #4 substring$ sortify
  1049.   *
  1050.   'sort.label :=
  1051. }
  1052.  
  1053. FUNCTION {first.presort}
  1054. { calc.label
  1055.   sort.label
  1056.   title.field field.used =
  1057.     {}
  1058.     { "    "
  1059.       *
  1060.       make.list.label sortify
  1061.       *
  1062.       "    "
  1063.       *
  1064.       title field.or.null
  1065.       sort.format.title
  1066.       *
  1067.     }
  1068.   if$
  1069.   #1 entry.max$ substring$
  1070.   'sort.key$ :=
  1071. }
  1072.  
  1073. ITERATE {first.presort}
  1074.  
  1075. SORT
  1076.  
  1077. STRINGS { last.sort.label next.extra }
  1078.  
  1079. INTEGERS { last.extra.num }
  1080.  
  1081. FUNCTION {initialize.last.extra.num}
  1082. { #0 int.to.chr$ 'last.sort.label :=
  1083.   "" 'next.extra :=
  1084.   #0 'last.extra.num :=
  1085. }
  1086.  
  1087. FUNCTION {forward.pass}
  1088. { last.sort.label sort.label =
  1089.     { last.extra.num #1 + 'last.extra.num :=
  1090.       last.extra.num int.to.chr$ 'extra.label :=
  1091.     }
  1092.     { "a" chr.to.int$ 'last.extra.num :=
  1093.       "" 'extra.label :=
  1094.       sort.label 'last.sort.label :=
  1095.     }
  1096.   if$
  1097. }
  1098.  
  1099. FUNCTION {reverse.pass}
  1100. { next.extra "b" =
  1101.     { "a" 'extra.label := }
  1102.     {}
  1103.   if$
  1104.   year empty$
  1105.     { "n.d." extra.label * 'list.year := }
  1106.     { year extra.label * 'list.year := }
  1107.   if$
  1108.   extra.label 'next.extra :=
  1109. }
  1110.  
  1111. EXECUTE {initialize.last.extra.num}
  1112.  
  1113. ITERATE {forward.pass}
  1114.  
  1115. REVERSE {reverse.pass}
  1116.  
  1117. FUNCTION {second.presort}
  1118. { make.list.label
  1119.   title.field field.used =
  1120.     { sort.format.title }
  1121.     { sortify }
  1122.   if$
  1123.   "    "
  1124.   *
  1125.   list.year field.or.null sortify
  1126.   *
  1127.   "    "
  1128.   *
  1129.   title.field field.used =
  1130.     {}
  1131.     { title field.or.null
  1132.       sort.format.title
  1133.       *
  1134.     }
  1135.   if$
  1136.   #1 entry.max$ substring$
  1137.   'sort.key$ :=
  1138. }
  1139.  
  1140. ITERATE {second.presort}
  1141.  
  1142. SORT
  1143.  
  1144. STRINGS { prev.author }
  1145.  
  1146. INTEGERS { number.label }
  1147.  
  1148. FUNCTION {initialize.longest.label}
  1149. {
  1150.   #1 'number.label :=
  1151.   "abcxyz" 'prev.author :=
  1152. }
  1153.  
  1154. FUNCTION {longest.label.pass}
  1155. author empty$ { editor empty$ {"foo"} {editor} if$} {author} if$
  1156.                  prev.author =
  1157.     { "\bysame" 'extra.label := }
  1158.     { "" 'extra.label :=
  1159. author empty$ { editor empty$ {"abcxyz"} {editor} if$} {author} if$
  1160.     'prev.author := 
  1161.     }
  1162.   if$
  1163. }
  1164.  
  1165. EXECUTE {initialize.longest.label}
  1166.  
  1167. ITERATE {longest.label.pass}
  1168.  
  1169. FUNCTION {begin.bib}
  1170. { preamble$ empty$
  1171.     {}
  1172.     { preamble$ write$ newline$ }
  1173.   if$
  1174.   "\ifx\undefined\bysame" write$ newline$
  1175.   "\newcommand{\bysame}{\leavevmode\hbox to\leftmargin{\hrulefill\,\,}}"
  1176.        write$ newline$
  1177.   "\fi" write$ newline$
  1178.   "\begin{thebibliography}{xx}" write$ newline$
  1179. }
  1180.  
  1181. EXECUTE {begin.bib}
  1182.  
  1183. EXECUTE {init.state.consts}
  1184.  
  1185. ITERATE {call.type$}
  1186.  
  1187. FUNCTION {end.bib}
  1188.         {newline$ "\end{thebibliography}" write$ newline$ }
  1189.  
  1190. EXECUTE {end.bib}
  1191.  
  1192.